<!DOCTYPE html>
<html lang="en">
	<head>
		<!-- Use correct character set. -->
		<meta charset="utf-8">
		<!-- Tell IE to use the latest, best version. -->
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<!-- Make the application on mobile take up the full browser screen and disable user scaling. -->
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
		<title>test-3d</title>
		<script src="Build/Cesium/Cesium.js"></script>
		<script src="jQuery/jquery-3.1.1.js"></script>
		<style>
			@import url(Build/Cesium/Widgets/widgets.css);

			html,
			body,
			#cesiumContainer {
				width: 100%;
				height: 100%;
				margin: 0;
				padding: 0;
				overflow: hidden;
			}
		</style>
	</head>
	<body>
		<!-- 控件容器 -->
		<div id="credit"></div>
		<!-- 地图容器 -->
		<div id="cesiumContainer"></div>
		<script>
			var viewer = new Cesium.Viewer('cesiumContainer', {
				geocoder: false, //搜索控件,搜索后镜头移动到搜索位置
				homeButton: false, //视角返回初始位置
				sceneModePicker:true, //地图模式控件(3d、2.5d、2d)
				baseLayerPicker: true, //地图图层选择
				navigationHelpButton: true, //操作帮助
				animation: true, //动画控件,控制视图动画播放速度
				creditContainer: "credit", //控件容器
				timeline: false, //时间线,指示当前时间,允许用户跳到特定的时间
				fullscreenButton: true, //全屏按钮
				//  vrButton:true,//vr按钮
			});
			 viewer.imageryLayers.removeAll();    
  
    
    var GoogleMap = new Cesium.ImageryLayer(new Cesium.UrlTemplateImageryProvider({
    	url:"http://mt1.google.cn/vt/lyrs=s&hl=zh-CN&x={x}&y={y}&z={z}&s=Gali"    //谷歌影像  	
        		}));
    viewer.imageryLayers.add(GoogleMap);   
    
    
    viewer._cesiumWidget._creditContainer.style.display = "none";  //	去除版权信息
    viewer.imageryLayers.addImageryProvider(new Cesium.WebMapTileServiceImageryProvider({   //调用影响中文注记服务
	    url: "http://t0.tianditu.com/cia_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=cia&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default.jpg",
	    layer: "tdtAnnoLayer",
	    style: "default",
	    format: "image/jpeg",
	    tileMatrixSetID: "GoogleMapsCompatible",
	    show: false
	}));		
			viewer.scene.debugShowFramesPerSecond = true; //显示帧速(fps)

     //自己给相机设置位置   114.07573, 33.62309,800.0
// var point = Cesium.Cartesian3.fromDegrees(114.07573, 33.62309,800.0);
// viewer.camera.setView({
//     destination : point,
//     orientation: {
//         heading : Cesium.Math.toRadians(0.0), //角度从上往下
//         pitch : Cesium.Math.toRadians(-90.0), // 侧面角度
//         roll : 0.0 //转动周围角度
//     }
// });

			//创建图层                            114.06932,33.60236   2457522.154792
viewer.clock.currentTime = new Cesium.JulianDate(2457522.154792);//颜色

var tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
    url : 'Specs/Data/Cesium3DTiles/Hierarchy/BatchTableHierarchy'
}));

tileset.readyPromise.then(function() {
    var boundingSphere = tileset.boundingSphere;
    viewer.camera.viewBoundingSphere(boundingSphere, new Cesium.HeadingPitchRange(0.0, -0.3, 0.0));
    viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
});

var handler = new Cesium.ScreenSpaceEventHandler(viewer.canvas);

//点击事件 点击标记物时打印出它的类名与属性
handler.setInputAction(function(movement) {
    var feature = viewer.scene.pick(movement.position);
    if (!Cesium.defined(feature)) {
        return;
    }
    console.log('Class: ' + feature.getExactClassName());
    console.log('Properties:');
    var propertyNames = feature.getPropertyNames();
    var length = propertyNames.length;
    for (var i = 0; i < length; ++i) {
        var name = propertyNames[i];
        var value = feature.getProperty(name);
        console.log('  ' + name + ': ' + value);
    }
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);

// 点击标记物时隐藏它
handler.setInputAction(function(movement) {
    var feature = viewer.scene.pick(movement.position);
    if (!Cesium.defined(feature)) {
        return;
    }
    feature.show = false;
}, Cesium.ScreenSpaceEventType.MIDDLE_CLICK);
  

		</script>
	</body>
</html>
